using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using HuiLian.Common.Input;
using HuiLian.Common.Output;
using HuiLian.Model.Platform;
using HuiLian.Service.Platform.ModelParam;
using HuiLian.Service.Platform.ModelParam.Input;
using System.Collections.Generic;
using HuiLian.Service.Platform.ModelParam.Output;
using Org.BouncyCastle.Crypto;

namespace HuiLian.Web.Controllers.Platform
{
    /// <summary>
    /// 模型参数管理
    /// </summary>
    public class ModelParamController : AreaController
    {
        private readonly IModelParamService _modelParamServices;

        public ModelParamController(IModelParamService modelParamServices)
        {
            _modelParamServices = modelParamServices;
        }

        /// <summary>
        /// 查询单条模型参数
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IResponseOutput> Get()
        {
            return await _modelParamServices.GetAsync();
        }

        /// <summary>
        /// 查询分页模型参数
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> GetPage(PageInput<ModelParamEntity> model)
        {
            return await _modelParamServices.PageAsync(model);
        }

        /// <summary>
        /// 新增模型参数
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> Add(ModelParamAddInput input)
        {
            return await _modelParamServices.AddAsync(input);
        }

        /// <summary>
        /// 修改模型参数
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<IResponseOutput> Update(ModelParamUpdateInput input)
        {
            return await _modelParamServices.UpdateAsync(input);
        }

        /// <summary>
        /// 删除模型参数
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<IResponseOutput> SoftDelete(long id)
        {
            return await _modelParamServices.SoftDeleteAsync(id);
        }

        /// <summary>
        /// 批量删除模型参数
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<IResponseOutput> BatchSoftDelete(long[] ids)
        {
            return await _modelParamServices.BatchSoftDeleteAsync(ids);
        }

        /// <summary>
        /// 获取管网健康度的图例
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IResponseOutput> PipeHealthLegend()
        {
            return await _modelParamServices.PipeHealthLegend();
        }
    }
}
